package cc.flybb.words;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import java.util.List;

public class WordViewModel extends AndroidViewModel {

    private WordRepository wordRepository;
    //public final LiveData<PagedList<Word>> concertList;


    public WordViewModel(@NonNull Application application) {
        super(application);
        this.wordRepository = new WordRepository(application);
    }

    public LiveData<List<Word>> getAllWordsLive(){
        return wordRepository.getAllWords();
    }
    public LiveData<List<Word>> findWordsWithPattern(String pattern) {
        return wordRepository.findWordsWithPattern(pattern);
    }

    void insertWords(Word... words) {
        wordRepository.insertWords(words);
    }
    void updateWords(Word... words) {
        wordRepository.updateWords(words);
    }
    void deleteWords(Word... words) {
        wordRepository.deleteWords(words);
    }
    void deleteAllWords() {
        wordRepository.deleteAllWords();
    }



}
